Graphics = function(options){
	var _options = {};
	$.extend(_options,this.options,options);
	$.extend(this,{
		_options:_options
	});
	this._init();
};
Graphics.prototype = {
		_options:{
			brush:null
		},
		_xmlns:"http://www.w3.org/2000/svg",
		_style:"stroke:rgb(99,99,99);stroke-width:2",
		_init:function(){
		},
		draw:function(info){
			switch(typeof info){
				case "Line":this.line(info);break;
				case "Ellipse":this.ellipse(info);break;
				case "Circle":this.circle(info);break;
				case "Rect":this.rect(info);break;
				case "Polyline":this.polyline(info);break;
				case "Polygon":this.polygon(info);break;
				case "Path":this.path(info);break;
			}
		},
		brush:function(style){
			this._style = style;
		},
		line:function(line){
			this.line(line.x1,line.y1,line.x2,line.y2);
		},
		line:function(x1,y1,x2,y2){
			var line = this._nodeNs("line",{
				x1:x1,
				y1:y1,
				x2:x2,
				y2:y2
			});
			line.setAttribute("style",this._style);
			
			return line;
		},
		ellipse:function(ellipse){
			this.ellipse(ellipse.cx,ellipse.cy,ellipse.rx,ellipse.ry);
		},
		ellipse:function(cx,cy,rx,ry){
			var ellipse = this._nodeNs("ellipse",{
				cx:cx,
				cy:cy,
				rx:rx,
				ry:ry
			});
			ellipse.setAttribute("style",this._style);
			
			return ellipse;
		},
		circle:function(circle){
			this.circle(circle.cx,circle.cy,circle.r);
		},
		circle:function(cx,cy,r){
			var circle = this._nodeNs("circle",{
				cx:cx,
				cy:cy,
				r:r
			});
			circle.setAttribute("style",this._style);
			
			return circle;
		},
		rect:function(rect){
			this.rect(rect.x,rect.y,rect.width,rect.height);
		},
		rect:function(x,y,w,h){
			var rect = this._nodeNs("rect",{
				x:x,
				x:y,
				width:w,
				height:h
			});
			rect.setAttribute("style",this._style);
			
			return rect;
		},
		polyline:function(points){
			var polyline = this._nodeNs("polyline",{
				points:points
			});
			polyline.setAttribute("style",this._style);
			
			return polyline;
		},
		polygon:function(points){
			var polygon = this._nodeNs("polygon",{
				points:points
			});
			polygon.setAttribute("style",this._style);
			
			return polygon;
		},
		path:function(directs){
			var path = this._nodeNs("path",{
				d:directs
			});
			path.setAttribute("style",this._style);
			
			return path;
		},
		text:function(x,y,txt){
			var text = this._nodeNs("text",{
				x:x,
				y:y,
				dx:0,
				dy:10
			});
			var animate = this._nodeNs("animate", {
			        attributeName : "x",
			        from          : "1000",
			        to            : "0",
			        begin        : "2s",
			        dur           : "0.5s",
			        id            : "swipe"
			});
			text.appendChild(this._nodeTx(txt));
			text.appendChild(animate);
			text.setAttribute("style",this._style);
			
			return text;
		},
		_node:function(){
			
		},
		_nodeTx:function(text){
			return document.createTextNode(text);
		},
		_nodeNs:function(node,attrs){
			var shape = document.createElementNS(this._xmlns,node);
			for(var attr in attrs){
				shape.setAttribute(attr,attrs[attr]);
			}
			return shape;
		}
};